package hw.test2;

import java.util.Collections;

public class Test {

    public static void main(String[] args) throws InterruptedException {
        MyRunnable r = new MyRunnable();


        Thread t1 = new Thread(r, "小红");
        t1.start();

        Thread t2 = new Thread(r, "小明");
        t2.start();


        System.out.println("==========================");
        t1.join();
        t2.join();


        System.out.println(r.one+",max="+ Collections.max(r.one));
        System.out.println(r.two+",max="+ Collections.max(r.two));

        if (r.one.stream().max(Integer::compareTo).get() > r.two.stream().max(Integer::compareTo).get()) {
            System.out.println("小明中奖了:"+Collections.max(r.one));
        }else{
            System.out.println("小红中奖了:"+Collections.max(r.two));
        }


    }
}
